package com.yunsom.testdemo.design.remark;

/**
 * @author Xbao
 * @version 1.0
 * @description 创建并在memento中存储状态
 * @date 2021/3/8 14:38
 */
public class Originator {
  private String state;

  public String getState() {
    return state;
  }

  public void setState(String state) {
    this.state = state;
  }

  public Memento setStateToMemento(){
    return new Memento(state);
  }

  public void recovery(Memento memento){
    state = memento.getState();
  }
}
